<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    {{message}}
    <div>
        <input type="text" v-model="info">
        <button @click="handleClick">添加</button>
        <ul>
            <todo-item v-for="item in list" v-bind:item="item"></todo-item>
        </ul>
    </div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    Vue.component('todo-item',{
        props: ['item'],
       template: '<li>{{item}}</li>'
    });
    new Vue({
        el: '#app',
        data() {
            return {
                message: 'hello TOmWang',
                info: '123',
                list: []
            }
        },
        methods: {
            handleClick(){
                console.log(this.info);
                this.list.push(this.info);
                this.info = '';
            }
        }
    })
</script>
</body>
</html>